package com.checkoutcheckins.client.callbacks;

import com.checkoutcheckins.client.panels.StatusPanel;
import com.google.gwt.user.client.Timer;

public class MessageTimer extends Timer {

	private StatusPanel statusPanel;

	public MessageTimer(StatusPanel statusPanel) {
		this.statusPanel = statusPanel;
	}

	@Override
	public void run() {

		System.out.println("stopped timer");

		statusPanel.clear();
		statusPanel.setInTimer(false);

		if (statusPanel.getQueueMessage() != null) {
			String queueHolder = statusPanel.getQueueMessage();
			boolean queueTimerHolder = statusPanel.getQueueTimer();
			
			statusPanel.setQueueMessage(null);
			statusPanel.setQueueTimer(false);
			
			statusPanel.showLoadMessage(queueHolder, queueTimerHolder);
		}
	}

}
